package com.qyl.main;

import com.qyl.mainclass.Car;
import com.qyl.homework.SmallCar;
import com.qyl.homeworkone.Truck;

public class MainTwo {
    public static void main(String[] args) {

        //实例化Car类型的对象
        Car car = new Car("奔驰","黑色");
        System.out.println("汽车的品牌是：" + car.getName());
        System.out.println("汽车的颜色是：" + car.getColor());
        car.drive();
        car.horn();

        //实例化SmallCar类型的对象
        SmallCar smallCar = new SmallCar("玛莎拉蒂","黑色");
        System.out.println("汽车的品牌是：" + smallCar.getName());
        System.out.println("汽车的颜色是：" + smallCar.getColor());

        //调用SmallCar类重写Car类的驾驶方法
        smallCar.drive();
        //调用SmallCar类汽车驾驶方法
        smallCar.driver1();
        //调用SmallCar类的汽车按喇叭方法
        smallCar.horn();
        //调用SmallCar类重载按喇叭的方法
        smallCar.horn("沸羊羊");


        //实例化Truck类型的对象
        Truck truck = new Truck("大运","白色");
        System.out.println("汽车的品牌是：" +truck.getName());
        System.out.println("汽车的颜色是：" + truck.getColor());

        //调用Truck类的重写Car类汽车驾驶方法
        truck.drive();
        //调用Truck类汽车驾驶方法
        truck.driver1();
        //调用Truck类汽车按喇叭方法
        truck.horn();
        //调用Truck类重载按喇叭的方法
        truck.horn("美羊羊");

    }
}
